package com.fneuch.mwg.rules.dice;

import com.fneuch.mwg.rules.Probability;

public class DiceProbability implements Probability {
	
	private Dice ofDice;
	
	public DiceProbability(Dice dice) {
		super();
		this.ofDice = dice;
	}
	
	/* (non-Javadoc)
	 * @see com.fneuch.game.dice.Probability#ofNumber(int)
	 */
	@Override
	public int ofNumber(int number) {
		double division = (double)1/ofDice.getMaxValue() *100; 
		return (int) Math.round(division);
	}
	
	/* (non-Javadoc)
	 * @see com.fneuch.game.dice.Probability#over(int)
	 */
	@Override
	public int over(int number) {
		double division = (double)(ofDice.getMaxValue() - number + 1)/ofDice.getMaxValue() *100; 
		return (int) Math.round(division);
	}

	/* (non-Javadoc)
	 * @see com.fneuch.game.dice.Probability#under(int)
	 */
	@Override
	public int under(int number) {
		double division = (double)number/ofDice.getMaxValue() *100; 
		return (int) Math.round(division);
	}

}
